{% extends "../component/_latout.html" %}
{% block style %}
<link href="/public/admin/css/plugins/bootstrap-table/bootstrap-table.min.css" rel="stylesheet">
{% endblock %}
{% block content %}
<!--wrap-->
<div>
    <input value="{{ctx.csrf}}" id="csrf-token" type="hidden"/>
    <!--主体部分-->
    <div class="row">
        <div class="col-sm-12">
          <div class="ibox m-b-none float-e-margins">
              <div class="ibox-title">
                  <h5>文章-所有用户</h5>
                  <div class="ibox-tools">
                      {# <a class="collapse-link">
                          <i class="fa fa-chevron-up"></i>
                      </a>
                      <a class="close-link">
                          <i class="fa fa-times"></i>
                      </a> #}
                  </div>
              </div>
              <div class="ibox-content">
                {# <div class="clear">
                  <div class="btn-group pull-left">
                      <a class="btn btn-outline btn-primary {% if params.userType %}{%else%}active{% endif %}" {% if params.userType %}href="/admin/user/list"{% endif %}>全部</a>
                      <a class="btn btn-outline btn-primary {% if params.userType==1 %}active{% endif %}" {% if params.userType != 1 %}href="/admin/user/list?userType=1"{% endif %}>管理员</a>
                      <a class="btn btn-outline btn-primary {% if params.userType==0 %}active{% endif %}" {% if params.userType != 0 %}href="/admin/user/list?userType=0"{% endif %}>普通用户</a>
                  </div>
                  <div class="m-l-xl pull-left">
                      <a class="btn btn-primary" >新增用户</a>
                  </div>
                </div> #}
                <!--共多少篇文章-->
                <div class="ibox m-b-none">
                  <form method="get" class="form-horizontal">
                    <div class="clear">
                            <div class="btn-group pull-left m-r-lg">
                                <a class="btn btn-outline btn-primary {% if params.userType %}{%else%}active{% endif %}" {% if params.userType %}href="/admin/user/list"{% endif %}>全部</a>
                                <a class="btn btn-outline btn-primary {% if params.userType==1 %}active{% endif %}" {% if params.userType != 1 %}href="/admin/user/list?userType=1"{% endif %}>管理员</a>
                                <a class="btn btn-outline btn-primary {% if params.userType==0 %}active{% endif %}" {% if params.userType != 0 %}href="/admin/user/list?userType=0"{% endif %}>普通用户</a>
                            </div>
                            <label class="control-label pull-left m-r-sm">
                                <h4 class="tx-l">
                                    筛选:
                                </h4>
                            </label>
                            <div class="clear pull-left">
                                <div class="my-select-control pull-left m-r-sm">
                                    <select class="form-control" name="orderBy">
                                        <option value="create_time" {% if params.orderBy == "create_time" %}selected{% endif %}>创建时间排序</option>
                                        {# <option value="modify_time" {% if params.orderBy == "modify_time" %}selected{% endif %}>修改时间排序</option>
                                        <option value="publish_time" {% if params.orderBy == "publish_time" %}selected{% endif %}>发布时间排序</option>
                                        <option value="view_count" {% if params.orderBy == "view_count" %}selected{% endif %}>浏览量排序</option> #}
                                    </select>
                                </div>
                                <div class="my-select-control pull-left m-r-sm">
                                    <select class="form-control" name="order">
                                        <option value="ASC" {% if params.order == "ASC" %}selected{% endif %}>升序</option>
                                        <option value="DESC" {% if params.order == "DESC" %}selected{% endif %}>降序</option>
                                    </select>
                                </div>
                            </div>
                          
                            <div class="input-group-container pull-left m-l">
                                <div class="input-group">
                                    <input type="text" name="keyword" value="{{ params.keyword }}" placeholder="请输入工号、姓名查找用户" class="input-sm form-control">
                                    <span class="input-group-btn m-b-none"><button type="button" id="submitSearch" class="btn btn-sm btn-primary">确定</button> </span>
                                </div>
                            </div>
                      </div>
                  </form>
                </div>
              </div>
          </div>
    
          <!--表格-->
          <div class="my-table ibox-content" >
            <table class="table table-hover  m-b-none" >
              <thead>
                  <tr>
                      {# <th class="bs-checkbox">
                          <div class="th-inner ">
                              <input name="btSelectAll" type="checkbox">
                          </div>
                          <div class="fht-cell"></div>
                      </th> #}
                      <th>
                          <div class="th-inner ">工号</div>
                          <div class="fht-cell"></div>
                      </th>
                      <th>
                          <div class="th-inner ">姓名</div>
                          <div class="fht-cell"></div>
                      </th>
                      <th>
                          <div class="th-inner ">头像</div>
                          <div class="fht-cell"></div>
                      </th>
                      <th>
                          <div class="th-inner ">职位</div>
                          <div class="fht-cell"></div>
                      </th>
                      <th>
                          <div class="th-inner ">部门</div>
                          <div class="fht-cell"></div>
                      </th>
                      <th>
                          <div class="th-inner ">创建日期</div>
                          <div class="fht-cell"></div>
                      </th>
                      <th>
                          <div class="th-inner ">最后登录ip</div>
                          <div class="fht-cell"></div>
                      </th>
                      <th>
                          <div class="th-inner ">操作</div>
                          <div class="fht-cell"></div>
                      </th>
                  </tr>
              </thead>
              <tbody>
                    {% for user in list %}
                    <tr>
                        {# <td class="bs-checkbox">
                            <input name="btSelectItem" type="checkbox">
                        </td> #}
                        <td class="text-success name-ellipse">
                            <a >{{ user.user_id }}</a>
                        </td>
                        <td class="text-success">{{ user.real_name }}</td>
                        <td class="text-success">
                            {% if user.avatar %}
                            <img src="{{ user.avatar }}" class="img-circle" width=40 height=40 />
                            {% else %}
                            --
                            {% endif %}
                        </td>
                        <td>{{ user.grade_name }}</td>
                        <td>{{ user.org_node_name }}</td>
                        <td>{{ user.create_time }}</td>
                        <td>{{ helper.int2ip(user.updated_ip)}}</td>
                        <td>   
                            {% if user.user_id != 948466 %}
                            <a userId="{{user.user_id}}" class="setUserType" userType="{{user.user_type}}">{% if user.user_type == 0 %}设为管理员{%else%}取消管理员{% endif %}</a>
                            {% else %}
                            --
                            {% endif %}
                        </td>
                    </tr>
                    {% else %}
                    <tr>
                        <td colspan="10">
                            <!--没有数据时的显示-->
                            <div class="no-data-container">
                            <i class="fa fa-frown-o"></i>
                            <span>您暂时还没有发布文章哦~</span>
                            </div>
                            <!--/没有数据时的显示-->
                        </td>
                    </tr>
                    {% endfor %}
              </tbody>
            </table>
            <!--分页-->
            {% include '../component/page.html' %}
            <!--/分页-->
          </div>
          <!--/表格-->
        </div>
    </div>
    <!--/主体部分-->
</div>

{% endblock %} 
{% block script %}
<script src="/public/admin/js/plugins/bootstrap-table/bootstrap-table.min.js"></script>
<script src="/public/admin/js/plugins/clipborad/clipborad.js"></script>
<script src="/public/admin/js/common/user/list.js"></script>
<script src="/public/admin/js/common/util/pageBean.js"></script>
{% endblock %} 
